﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartyArticleManageEdit.aspx.cs" ValidateRequest="false" Inherits="SysManage.Module.Article.PartyArticleManageEdit" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
    <script src="../../../../Resource/ueditor/ueditor.config.js"></script>
    <script src="../../../../Resource/ueditor/ueditor.all.min.js"></script>
    <script src="../../../../Scripts/jquery.min.js"></script>
    <link href="../../../../Resource/js/uploadify.css" rel="stylesheet" />
    <script src="../../../../Resource/js/jquery.uploadify.js"></script>
    <script type="text/javascript">
        $(function () {
            var filePath = '';
            var fileID = '';
            $("#uploadify").uploadify({
                //指定swf文件
                'swf': '../../../../Resource/js/uploadify.swf',
                //后台处理的页面
                'uploader': 'uploadfile.ashx',
                //按钮显示的文字
                'buttonText': '浏　览',
                //上传文件的类型  默认为所有文件    'All Files'  ;  '*.*'
                //在浏览窗口底部的文件类型下拉菜单中显示的文本
                'fileTypeDesc': 'Image Files',
                //允许上传的文件后缀
                //'fileTypeExts': '*.gif; *.jpg; *.png;*.zip',
                //发送给后台的其他参数通过formData指定
                //'formData': { 'someKey': 'someValue', 'someOtherKey': 1 },
                //上传文件页面中，你想要用来作为文件队列的元素的id, 默认为false  自动生成,  不带#
                //'queueID': 'fileQueue',
                'fileSizeLimit': 204800000,
                //选择文件后自动上传
                'auto': false,
                //设置为true将允许多文件上传
                'multi': true,
                //上传成功
                'onUploadSuccess': function (file, data, response) {
                    var obj = (new Function("return " + data))();//【json字符串转为json对象。】
                    $("#rep").append("<span>" + obj.Msg + "!</span>");//data为后台返回结果。
                    filePath += obj.FileTitle;
                    fileID += obj.Id;
                    $("#Panel1_SimpleForm1_PanelFile_txtFileID").val(fileID);
                    $("#Panel1_SimpleForm1_PanelFile_txtFilePath").val(filePath);
                }
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server" style="background-color: #0000FF" onsubmit="return UESync();">
        <f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
        <f:Panel ID="Panel1" ShowBorder="false" ShowHeader="false" AutoScroll="true" runat="server">
            <Items>
                <f:SimpleForm ID="SimpleForm1" ShowBorder="false" ShowHeader="false" runat="server"
                    BodyPadding="10px" Title="SimpleForm">
                    <Items>
                        <%--                        <f:TextBox ID="txtTitle" runat="server" Label="文章标题" LabelAlign="right" Required="true" ShowRedStar="true" RequiredMessage="请填写文章标题" >
                        </f:TextBox>--%>
                        <f:TextArea ID="txtTitle" runat="server" Label="文章标题" LabelAlign="right" Required="true" ShowRedStar="true" RequiredMessage="请填写文章标题"></f:TextArea>
                        <f:TextBox ID="txtSubhead" runat="server" Label="文章副标题" LabelAlign="right">
                        </f:TextBox>
                        <f:TextBox ID="txtAuthor" runat="server" Label="作者" LabelAlign="right" Required="true" ShowRedStar="true" RequiredMessage="请填写作者">
                        </f:TextBox>
                        <f:TextBox ID="txtAuthorUrl" runat="server" Label="作者原链接" LabelAlign="right">
                        </f:TextBox>
                        <%-- 有下拉菜单(下级分类)的所属模块 --%>
                        <f:DropDownList ID="ddlModule" runat="server" Label="所属模块" Readonly="true" LabelAlign="right">
                            <%--  <f:ListItem Value="PartyBuildingWork" Text="党建工作" />
                            <f:ListItem Value="OfficeBuilding" Text="机关建设" />
                            <f:ListItem Value="AntiCorruption" Text="反腐倡廉" />
                            <f:ListItem Value="DynamicWork" Text="工作动态" />--%>
                        </f:DropDownList>
                        <%-- 没有下拉菜单(下级分类)的所属模块 --%>
                        <f:TextBox ID="ddlModule1" Hidden="true" runat="server" Label="所属模块" LabelAlign="right"></f:TextBox>

                        <f:DropDownList ID="ddlCategory" runat="server" Label="文章类型" LabelAlign="right">
                        </f:DropDownList>
                        <f:RadioButtonList ID="rblFlags" runat="server" Label="置顶格式" Width="480px" LabelAlign="right">
                        </f:RadioButtonList>
                        <f:TextBox ID="txtArticlesLable" runat="server" Label="文章标签" LabelAlign="right">
                        </f:TextBox>
                        <f:TriggerBoxPicker runat="server" ID="ppBranch" Required="true" EnableEdit="false" LabelAlign="right" ShowRedStar="false" Label="所属组织" WindinsTitle="选择组织" WindinsHeight="450px" WindinsWidth="700px" WindinsUrl="../../../Share/Picker/BranchSinglePicker.aspx" Trigger1Icon="None">
                        </f:TriggerBoxPicker>
                        <f:TextArea ID="txtSummary" Label="文章简介" runat="server" LabelAlign="right">
                        </f:TextArea>
                        <f:FileUpload runat="server" LabelAlign="right" EmptyText="请选择一张图片" ID="filePhoto"
                            Label="上传图片" ButtonText="图片" ButtonIcon="ImageAdd" AutoPostBack="true" OnFileSelected="filePhoto_FileSelected" AcceptFileTypes="image/*">
                        </f:FileUpload>
                        <f:HyperLinkImagePreview runat="server" ID="HyperLink1" CssStyle="cursor:pointer"
                            ShowEmptyLabel="true" LabelAlign="right" Text="查看图片" LabelWidth="80px">
                        </f:HyperLinkImagePreview>
                        <f:DatePicker runat="server" Label="添加时间" EmptyText="请选择时间"
                            ID="txtCreateTime">
                        </f:DatePicker>

                        <f:ContentPanel ShowBorder="false" ShowHeader="false" AutoScroll="true" ID="PanelFile" CssClass="header"
                            runat="server">
                            <div>
                                <div id="fileQueue">
                                </div>
                                <input type="file" name="uploadify" id="uploadify" />
                                <p>
                                    <a href="javascript:$('#uploadify').uploadify('upload','*')">上传</a>| 
                                    <a href="javascript:$('#uploadify').uploadify('cancel','*')">取消上传</a>
                                </p>
                            </div>
                            <br />
                            <div id="rep" hidden="hidden">返回的结果：</div>
                            <div hidden="hidden">
                                <input id="txtFileID" type="hidden" runat="server" value="" />
                                <textarea id="txtFilePath" runat="server" style="width: 100%"></textarea>
                            </div>
                        </f:ContentPanel>

                        <f:Window ID="Window1" Title="编辑" Hidden="true" EnableIFrame="true" runat="server"
                            EnableMaximize="true" EnableResize="true" Target="Parent" OnClose="Window1_Close"
                            IsModal="True" Width="650px" Height="450px">
                        </f:Window>
                        <f:HiddenField ID="HiddenField1" runat="server">
                        </f:HiddenField>

                        <f:Label ID="lbContent" runat="server" LabelAlign="right" Text="文章内容："></f:Label>
                        <f:ContentPanel ID="ContentPanel1" runat="server" ShowBorder="false" ShowHeader="false">
                            <script type="text/plain" id="editor"></script>
                        </f:ContentPanel>
                        <f:HiddenField ID="hdImageId" runat="server"></f:HiddenField>
                    </Items>
                </f:SimpleForm>
            </Items>
            <Toolbars>
                <f:Toolbar ID="Toolbar1" runat="server" Position="Bottom" ToolbarAlign="Center">
                    <Items>
                        <f:Button ID="btnSaveClose" ValidateForms="SimpleForm1" Icon="SystemSaveClose"
                            OnClick="btnSaveClose_Click" runat="server" Text="保存并关闭">
                        </f:Button>
                        <f:ToolbarSeparator ID="ToolbarSeparator2" runat="server">
                        </f:ToolbarSeparator>
                        <f:Button ID="btnClose" Icon="SystemClose" EnablePostBack="false" runat="server"
                            Text="关闭" DisableControlBeforePostBack="True">
                        </f:Button>
                    </Items>
                </f:Toolbar>
            </Toolbars>
        </f:Panel>
    </form>
</body>
</html>
<script>
    var editorContent = '<%=EditorContent%>';

    var ue = UE.getEditor("editor", {
        initialFrameWidth: '100%',
        initialFrameHeight: '400px',
        enableAutoSave: false,
        saveInterval: 1000000,
        elementPathEnabled: false,
        autoHeightEnabled: false
    });

    ue.ready(function () {
        if (editorContent) {
            ue.setContent(editorContent);
        }
    });

    function UESync() {
        var editor = UE.getEditor('editor')
        editor.sync();
        return true;
    }
</script>
